// run: $exec < input
#include <iostream>
#include <algorithm>
#include <vector>

int const inf = 1 << 28;
int const maxn = 1000;
int A[maxn];
int n, l;

int lis(std::vector<int> & a, int n)
{
	int ans = 1;
	A[0] = -inf;
	A[1] = a[1];
	for (int i = 2; i <= n;i++) {
		int j = std::lower_bound (A+1,A+ans+1,a[i]) -A;
		if (j>ans) ans = j;
		A[j] = a[i];
	}
	return ans;
}

void print(std::vector<int> & a)
{
	for (auto i : a)
		std::cout << i << ' ';
	std::cout << '\n';
}

int main()
{
	int T;
	std::cin >> T;
	for (int ti = 1; ti <= T; ti++) {
		std::cout << "Case #" << ti << ": ";
		std::cin >> n >> l;
		std::vector<int> v(n);
		int ans = 0;
		for (int i = 0; i < n; i++) std::cin >> v[i];
		for (int i = 0; i + l <= n; i++) {
			std::vector<int> tmp;
			tmp.push_back(inf);
			for (int j = 0; j < n; j++)
				if (j < i || j >= i + l) tmp.push_back(v[j]);
			ans = std::max(ans, lis(tmp, n - l));
		}
		std::cout << ans << '\n';
	}
}


